<template>
  <el-form :model="formInline" class="form-inline">
    <el-row class="row">
      <el-form-item label="发布屏编号：">
        <el-input
          v-model="formInline.screenCode"
          placeholder="--请输入--"
        ></el-input>
      </el-form-item>
      <el-form-item label="设备名称：">
        <el-input
          v-model="formInline.screenName"
          placeholder="--请输入--"
        ></el-input>
      </el-form-item>

      <el-form-item label="所属区域：">
        <el-input
          v-model="formInline.region"
          placeholder="--请输入--"
        ></el-input>
      </el-form-item>
      <el-form-item class="btns">
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button type="success" class="m-left" @click="onClear"
          >清空</el-button
        >
      </el-form-item>
    </el-row>
    <el-row>
      <el-form-item label="设备状态：">
        <el-select
          v-model="formInline.deviceState"
          placeholder="--请选择--"
          @change="handleStreetChange"
        >
          <el-option
            v-for="item in stateArray"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>
    </el-row>
  </el-form>
</template>

<script setup>
import { reactive, defineEmits } from 'vue'

const formInline = reactive({
  screenCode: '',
  screenName: '',
  region: '',
  deviceState: null
})

const stateArray = [
  {
    label: '在线',
    value: 0
  },
  {
    label: '离线',
    value: 1
  }
]

const emits = defineEmits(['onSearch'])

const onSubmit = () => {
  emits('onSearch', formInline)
}
const onClear = () => {
  formInline.screenCode = ''
  formInline.screenName = ''
  formInline.region = ''
  formInline.deviceState = null
  emits('onSearch', formInline)
}
</script>

<style lang="scss" scoped>
.form-inline {
  width: 100%;
  position: relative;
  // display: flex;
  // column-gap: 20px;
  // padding-bottom: 33px;
  .row {
    display: flex;
    column-gap: 5%;
  }
  .btns {
    position: absolute;
    right: 0;
    top: 1px;
    .m-left {
      margin-left: 20px;
    }
  }
}
</style>
